//
//  MCMainTabBarController.m
//  TLYL
//
//  Created by miaocai on 2017/6/1.
//  Copyright © 2017年 TLYL01. All rights reserved.
//

#import "MCMainTabBarController.h"
#import "MCLotteryHallViewController.h"
#import "MCLotteryDrawViewController.h"
#import "MCDiscoveryViewController.h"
#import "MCMineViewController.h"
#import "MCMainNavigationController.h"
#import "UIColor+MCColor.h"
#import "UIImage+Extension.h"

@interface MCMainTabBarController ()

@end

@implementation MCMainTabBarController

+(void)load{
    
   UITabBarItem *tabBarItem = [UITabBarItem appearance];
    [tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:MC_ColorWithAlpha(54, 128, 211, 1),NSFontAttributeName:[UIFont boldSystemFontOfSize:12]} forState:UIControlStateSelected];
     [tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:MC_ColorWithAlpha(125, 125, 134, 1),NSFontAttributeName:[UIFont boldSystemFontOfSize:12]} forState:UIControlStateNormal];
}

- (void)viewDidLoad {
    
    [super viewDidLoad];
    [self setChildViewController];
//    self.view.backgroundColor = [UIColor whiteColor];
}

- (void)setChildViewController{
    
    [self setChildViewController:[[MCLotteryHallViewController alloc] init] title:@"大厅" normalImage:[UIImage originalImageFromImageNamed:@"tabbar_home_normal"] selectedImage:[UIImage originalImageFromImageNamed:@"tabbar_home_selected"]];
     [self setChildViewController:[[MCLotteryDrawViewController alloc] init] title:@"开奖" normalImage:[UIImage originalImageFromImageNamed:@"tabbar_draw_normal"] selectedImage:[UIImage originalImageFromImageNamed:@"tabbar_draw_selected"]];
     [self setChildViewController:[[MCDiscoveryViewController alloc] init] title:@"发现" normalImage:[UIImage originalImageFromImageNamed:@"tabbar_discovery_normal"] selectedImage:[UIImage originalImageFromImageNamed:@"tabbar_discovery_selected"]];
     [self setChildViewController:[[MCMineViewController alloc] init] title:@"我的" normalImage:[UIImage originalImageFromImageNamed:@"tabbar_mine_normal"] selectedImage:[UIImage originalImageFromImageNamed:@"tabbar_mine_selected"]];
    
    
}

- (void)setChildViewController:(UIViewController *)viewController title:(NSString *)title normalImage:
(UIImage *)image selectedImage:(UIImage *)selectedImage{
    
    if (/* DISABLES CODE */ (0)) {
        [self requestTabBarIconFromServer];
    } else {
        viewController.tabBarItem.title = title;
        viewController.tabBarItem.image = image;
        viewController.tabBarItem.selectedImage = selectedImage;
        MCMainNavigationController *navi = [[MCMainNavigationController alloc] initWithRootViewController:viewController];
        [self addChildViewController:navi];
      
    }
}

- (void)requestTabBarIconFromServer{
    
    //从服务器获得tabbar数据
}


@end
